<template>
  <div class="editAddress-view">
    <van-nav-bar title="修改地址" left-arrow @click-left="goAddressList" />
    <van-address-edit
      :area-list="areaList"
      show-delete
      :is-saving="loading"
      :address-info="info"
      show-set-default
      :area-columns-placeholder="['请选择', '请选择', '请选择']"
      @save="onSave"
      @delete="onDelete"
      @change-detail="onChangeDetail"
    />
  </div>
</template>
<script>
import areaList from "./area-list";
export default {
  data() {
    return {
      areaList,
      loading: false,
      info: {
        id: 1,
        name: "陈家辉",
        tel: "15807085613",
        addressDetail: "555街道",
        areaCode: "820201",
        isDefault: true
      }
    };
  },
  methods: {
    goAddressList() {
      this.$router.push("/address");
    },
    onSave() {
      //   this.loading = true;
      this.$toast("保存成功");
    },
    onDelete() {
      this.$toast("删除成功");
    },
    onChangeDetail(val) {
      if (val) {
        this.searchResult = [
          {
            name: "黄龙万科中心",
            address: "杭州市西湖区"
          }
        ];
      } else {
        this.searchResult = [];
      }
    }
  }
};
</script>
<style lang="less">
.editAddress-view{
    background-color: #efefef;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
}
.van-switch--on {
  background-color: #426496;
}
.van-button--danger {
  background-color: #426496;
  border-color: #426496;
}
.van-radio__icon--checked {
  .van-icon-success {
    background-color: #426496 !important;
    border-color: #426496 !important;
  }
}
</style>